<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<div th:replace="~{common/common::head}"></div>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <fieldset class="layui-elem-field layui-field-title">
                    <legend><a style="color: rgb(30 159 255)" class="sqli-jpa">SQL注入攻击 - JPA</a></legend>
                    <blockquote class="layui-elem-quote layui-quote-nm"
                                style="font-size: 15px;background-color: #a7deefab;box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075) !important">
                        <p>
                        <pre>   JPA（Java Persistence API）是Java EE标准的ORM规范，它提供了一种优雅的方式来操作数据库。尽管JPA提供了许多安全特性，但不当使用仍可能导致SQL注入漏洞。</pre>
                        </p>
                    </blockquote>
                </fieldset>
            </div>

            <div class="layui-col-md12" style="margin-top: 10px">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md6">
                        <h1><span class="iconfont icon-bug">  漏洞场景：JPA-JPQL注入</span></h1>
                        <div class="layui-tab layui-tab-brief">
                            <ul class="layui-tab-title">
                                <li class="layui-this">查询</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="username" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户名" value="admin' OR '1'='1" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="vul1-jpa-jpql-select" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-col-md12">
                                    <div class="layui-card">
                                        <div class="layui-card-header"><i class="fa fa-warning icon-output"></i>测试结果</div>
                                        <div class="layui-card-body layui-text layadmin-text">
                                            <pre id="vul1-jpa-jpql-result" style="color: red;font-size: 15px;"></pre>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-col-md6">
                        <h1><span class="iconfont icon-code">  缺陷代码</span></h1>
                        <div class="m-auto div-shadow shadow p-3 mb-5 bg-white rounded">
                            <div class="code-editor" id="vul1JpaJpql">
                            </div>
                        </div>
                    </div>
                </div>
            </div>

<!--            <div class="layui-col-md12" style="margin-top: 10px">-->
<!--                <div class="layui-row layui-col-space15">-->
<!--                    <div class="layui-col-md6">-->
<!--                        <h1><span class="iconfont icon-bug">  漏洞场景：JPA-动态排序注入</span></h1>-->
<!--                        <div class="layui-tab layui-tab-brief">-->
<!--                            <ul class="layui-tab-title">-->
<!--                                <li class="layui-this">查询</li>-->
<!--                            </ul>-->
<!--                            <div class="layui-tab-content">-->
<!--                                <div class="layui-tab-item layui-show">-->
<!--                                    <blockquote class="layui-elem-quote main_btn">-->
<!--                                        <form class="layui-form" style="display: flex; justify-content: space-between;">-->
<!--                                            <div style="display: flex; align-items: center;">-->
<!--                                                <input type="text" name="orderBy" style="width: 150px;" required-->
<!--                                                       lay-verify="required" placeholder="排序字段" autocomplete="off"-->
<!--                                                       class="layui-input">-->
<!--                                            </div>-->
<!--                                            <div style="display: flex; align-items: center;">-->
<!--                                                <button class="layui-btn layui-btn-normal"-->
<!--                                                        style="width: 100px; margin-left: 10px;"-->
<!--                                                        lay-filter="vul3-jpa-sort-select" lay-submit="">-->
<!--                                                    <span class="iconfont icon-zhihang">Run</span>-->
<!--                                                </button>-->
<!--                                            </div>-->
<!--                                        </form>-->
<!--                                    </blockquote>-->
<!--                                </div>-->
<!--                                <div class="layui-col-md12">-->
<!--                                    <div class="layui-card">-->
<!--                                        <div class="layui-card-header"><i class="fa fa-warning icon-output"></i>测试结果</div>-->
<!--                                        <div class="layui-card-body layui-text layadmin-text">-->
<!--                                            <pre id="vul3-jpa-sort-result" style="color: red;font-size: 15px;"></pre>-->
<!--                                        </div>-->
<!--                                    </div>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->

<!--                    <div class="layui-col-md6">-->
<!--                        <h1><span class="iconfont icon-code">  缺陷代码</span></h1>-->
<!--                        <div class="m-auto div-shadow shadow p-3 mb-5 bg-white rounded">-->
<!--                            <div class="code-editor" id="vul2JpaSort">-->
<!--                            </div>-->
<!--                        </div>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->

            <div class="layui-col-md12" style="margin-top: 10px">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-md6">
                        <h1><span class="iconfont icon-anquan">  安全场景：JPA-参数化查询</span></h1>
                        <div class="layui-tab layui-tab-brief">
                            <ul class="layui-tab-title">
                                <li class="layui-this">查询</li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <blockquote class="layui-elem-quote main_btn">
                                        <form class="layui-form" style="display: flex; justify-content: space-between;">
                                            <div style="display: flex; align-items: center;">
                                                <input type="text" name="username" style="width: 150px;" required
                                                       lay-verify="required" placeholder="用户名" value="admin' OR '1'='1" autocomplete="off"
                                                       class="layui-input">
                                            </div>
                                            <div style="display: flex; align-items: center;">
                                                <button class="layui-btn layui-btn-normal"
                                                        style="width: 100px; margin-left: 10px;"
                                                        lay-filter="safe1-jpa-param-select" lay-submit="">
                                                    <span class="iconfont icon-zhihang">Run</span>
                                                </button>
                                            </div>
                                        </form>
                                    </blockquote>
                                </div>
                                <div class="layui-col-md12">
                                    <div class="layui-card">
                                        <div class="layui-card-header"><i class="fa fa-warning icon-output-safe"></i>测试结果</div>
                                        <div class="layui-card-body layui-text layadmin-text">
                                            <pre id="safe1-jpa-param-result" style="color: red;font-size: 15px;"></pre>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="layui-col-md6">
                        <h1><span class="iconfont icon-code">  安全代码</span></h1>
                        <div class="m-auto div-shadow shadow p-3 mb-5 bg-white rounded">
                            <div class="code-editor" id="safeJpaParam">
                            </div>
                        </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<div th:replace="~{common/common::script}"></div>

<script type="text/javascript">
    layui.use(['layer', 'miniTab', 'common'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            miniTab = layui.miniTab,
            common = layui.common;
        miniTab.listen();
        layer.msg("SQL注入-JPA")

        common.formListenFun("vul1-jpa-jpql-select", "select", "/sqli/jpa/vul1", "vul1-jpa-jpql-result","get");
        common.formListenFun("vul3-jpa-sort-select", "select", "/sqli/jpa/vul2", "vul3-jpa-sort-result","get");
        common.formListenFun("safe1-jpa-param-select", "select", "/sqli/jpa/safe", "safe1-jpa-param-result","get");

        var cmConfig = {
            lineNumbers: true,
            lineWrapping: false,
            indentUnit: 4,
            indentWithTabs: true,
            theme: 'juejin',
            styleActiveLine: {nonEmpty: true},
            fontSize: "18px",
            mode: "text/x-java"
        };
        var cmConfigSafe = {
            lineNumbers: true,
            lineWrapping: false,
            indentUnit: 4,
            indentWithTabs: true,
            theme: 'juejinsafe',
            styleActiveLine: {nonEmpty: true},
            fontSize: "18px",
            mode: "text/x-java"
        };

        CodeMirror(document.getElementById("vul1JpaJpql"), Object.assign({}, cmConfig, {
            value: vul1JpaJpql
        }));
        CodeMirror(document.getElementById("vul2JpaSort"), Object.assign({}, cmConfig, {
            value: vul2JpaSort
        }));
        CodeMirror(document.getElementById("safeJpaParam"), Object.assign({}, cmConfigSafe, {
            value: safeJpaParam
        }));
    });
</script>

</body>
</html>
